<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>

    </style>
</head>

<body>
    <input type="text">
    <input type="button" value="帅哥" onclick="f(1)">
    <input type="button" value="美女" onclick="f(2)">
    <hr>
    <script>
        let t = document.querySelector("input");
        function f(x) {
            for (let i = 0; i < t.value; i++) {
                let img = document.createElement("img");
                let url = x == 1 ? "a.jpg" : "b.jpg";
                img.src = url;
                document.body.append(img);
            }
        }
    </script>


</body>

</html>